<!DOCTYPE html>
<html>
<head>
	<title></title>
	<style type="text/css">
		#box{
			width: 100px;height: 100px;background-color: red;
		}
	</style>
	<script type="text/javascript">
		window.onload = function () {
			var text1 = document.getElementById('text1');
			var text2 = document.getElementById('text2');
			var btn = document.getElementById('btn');
			var box = document.getElementById('box');
			btn.onclick = function(){
				var name = text1.value;
				var val = text2.value;
				console.log(name,val);
				box.style[name] = val;
			};
		};
	</script>
</head>
<body>
	<input type="text" name="" id="text1">
	<input type="text" name="" id="text2">
	<input type="button" name="" id="btn" value="Click">
	<div id="box"></div>
</body>
</html>